import {ADD_LIST,REMOVE_LIST} from '../action-types';
let initState=['吃饭','睡觉','逛街'];
export const todo = (state = initState, action) => {
    switch (action.type) {
        case ADD_LIST:
            return [...state,action.val];
        case REMOVE_LIST:
            return state.filter((item,index)=>index!==action.index)
        default:
            return state
    }
}